package com.sun.relationship.twoway;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;

@Entity
@Table(name = "DEMO_PROJECT_2WAY")
public class Project2Way implements Serializable {

	private static final long serialVersionUID = -5748107211344761914L;

	private String id;
	private String name;
	private Integer age;
	private List<Member2Way> member = new ArrayList<>();

	public Project2Way() {
	}

	public Project2Way(String name, Integer age) {
		this.name = name;
		this.age = age;
	}

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO, generator = "bizGenerator")
	@GenericGenerator(name = "bizGenerator", strategy = "uuid")
	@Column(length = 32)
	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Integer getAge() {
		return age;
	}

	public void setAge(Integer age) {
		this.age = age;
	}

	public void setMember(List<Member2Way> member) {
		this.member = member;
	}

	@OneToMany(mappedBy="project2Way")
	public List<Member2Way> getMember() {
		return member;
	}

	@Override
	public String toString() {
		return "Project2Way [id=" + id + ", name=" + name + ", age=" + age + "]";
	}
}
